<div [dMovable]="true" [handle]="header" [moveEl]="parent">
  <div class="modal-header" #header>
    <d-row [dGutter]="[12, 12]">
      <d-col [dSpan]="22">
        {{ 'app.common.operate.new.title' | translate: data.title }}
      </d-col>
      <d-col [dSpan]="2" style="text-align: right">
        <d-button
          icon="icon-close"
          bsStyle="text-dark"
          title="{{ 'app.common.operate.close.label' | translate }}"
          (btnClick)="data.onClose()"
        ></d-button>
      </d-col>
    </d-row>
  </div>
  <form dForm ngForm [layout]="formLayout" [dValidateRules]="formConfig.rule" #form="dValidateRules" (dSubmit)="submitForm($event)">
    <div class="modal-body" style="padding: 0px 48px 0px 48px">
      <d-form-item>
        <d-form-label [required]="true">{{ 'datadev.clusterName' | translate }}</d-form-label>
        <d-form-control>
          <input dTextInput name="clusterName" [(ngModel)]="formData.clusterName" [dValidateRules]="formConfig.clusterNameRules" />
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label [required]="true">{{ 'datadev.clusterType' | translate }}</d-form-label>
        <d-form-control>
          <d-select
            [options]="clusterTypeList"
            name="clusterType"
            [filterKey]="'label'"
            [allowClear]="true"
            [(ngModel)]="formData.clusterType"
            [dValidateRules]="formConfig.clusterTypeRules"
            [extraConfig]="{ selectedItemWithTemplate: { enable: true } }"
          >
            <ng-template let-option="option"> {{ option['label'] }} </ng-template>
          </d-select>
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label>{{ 'datadev.clusterHome' | translate }}</d-form-label>
        <d-form-control>
          <input dTextInput name="clusterHome" [(ngModel)]="formData.clusterHome" [dValidateRules]="formConfig.clusterHomeRules" />
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label>{{ 'datadev.clusterVersion' | translate }}</d-form-label>
        <d-form-control>
          <input dTextInput name="clusterVersion" [(ngModel)]="formData.clusterVersion" [dValidateRules]="formConfig.clusterVersionRules" />
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label>{{ 'datadev.remark' | translate }}</d-form-label>
        <d-form-control>
          <input dTextInput name="remark" [(ngModel)]="formData.remark" [dValidateRules]="formConfig.remarkRules" />
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label [required]="true">{{ 'datadev.clusterConf' | translate }}</d-form-label>
        <d-form-control>
          <textarea
            dTextarea
            style="height: 120px"
            resize="vertical"
            name="clusterConf"
            placeholder="{{ 'datadev.cluster.placeholder' | translate }}"
            [(ngModel)]="formData.clusterConf"
            [dValidateRules]="formConfig.clusterConfRules"
          ></textarea>
        </d-form-control>
      </d-form-item>
    </div>
    <div class="modal-footer" style="text-align: right; padding-right: 42px">
      <d-form-operation>
        <d-button style="margin-right: 4px" bsStyle="common" (btnClick)="data.onClose($event)">{{
          'app.common.operate.cancel.label' | translate
        }}</d-button>
        <d-button bsStyle="primary" dFormSubmit>{{ 'app.common.operate.confirm.label' | translate }}</d-button>
      </d-form-operation>
    </div>
  </form>
</div>
